
/*
 页面父类基础界面
 */
import 'package:xsdk_flutter/xsdk/framework/page/x_page_state.dart';
import 'package:flutter/material.dart';
import 'package:xsdk_flutter/xsdk/framework/support/xsdk_sliver_persistent_header_delegate.dart';
import 'package:xsdk_flutter/xsdk/utils/x_utils_widget.dart';

/*
可折叠头部
利用CustomScrollView+SliverPersistentHeader,
XSDKSliverPersistentHeaderDelegate(SliverPersistentHeaderDelegate)

注意:
在CustomScrollView内的items自身不能带滚动,有些Widget需要转为对应Sliver开头的
 */
abstract class XPageFoldHeaderState extends XPageState{


  XPageFoldHeaderState({
    super.isKeepPageState=false,
    super.xTag,
  });

  @override
  Widget getBodyWidget(BuildContext context) {
    return XWidgetUtils.getLayoutSliverScrollView(
        children: [
          SliverPersistentHeader(
              delegate: XSDKSliverPersistentHeaderDelegate(
                  minSize: getFoldHeaderMinHeight(),
                  maxSize: getFoldHeaderMaxHeight(),
                  children_in_stack: getFoldHeaderWidgets_in_stack())
          ),
          getMainWidget_in_CustomScrollView(),
        ]
    );
  }


  /*
  折叠头部的最小高度
   */
  @required
  double getFoldHeaderMinHeight();

  /*
  折叠头部的最大高度
   */
  @required
  double getFoldHeaderMaxHeight();

  /*
  折叠头部的widgets
   */
  @required
  List<Widget> getFoldHeaderWidgets_in_stack();

  /*
  主体Widget,
  注意:是嵌套在CustomScrollView中,因此其内的items自身不能带滚动,有些Widget需要转为对应Sliver开头的
  通常使用Column等
   */
  @required
  Widget getMainWidget_in_CustomScrollView();









}